package com.sunflower.bath.service.impl;


import java.util.List;
import org.framework.mybatis.Criteria;
import org.sunflower.framework.utils.UUIDUtils;

import com.sunflower.bath.model.JobServerDb;
import com.sunflower.bath.repository.IJobServerDbRepository;
import com.sunflower.bath.service.IJobServerDbService;


public class JobServerDbServiceImpl implements IJobServerDbService{

	public List<JobServerDb> queryPage(Criteria<JobServerDb> param){
		List<JobServerDb> list = jobServerDbRepository.queryPage(param); 
		return list;  }

	public Integer queryPageCount(Criteria<JobServerDb> param){
		return (Integer) jobServerDbRepository.queryPageCount(param);
	}

	public JobServerDb queryEntityById(String id){
		return jobServerDbRepository.queryEntityById(id);
	}

	public String insert(JobServerDb record){
		String id = UUIDUtils.shortUuidAddTime();
		record.setServerId(id);;
		int result = jobServerDbRepository.insert(record);
		if ( result != 1) { 
			return "新增数据库配置失败！";
		} 
		return null;
	}

	public String updateByCriteria(Criteria<JobServerDb> param){
		int result = jobServerDbRepository.updateByCriteria(param);
		if ( result != 1) { 
			return "修改数据库配置失败！";
		} 
		return null;
	}

	public String deleteById(String id){
		int result = jobServerDbRepository.deleteById(id);
		if ( result != 1) { 
			return "删除数据库配置失败！";
		} 
		return null;
	}

	public String deleteByCriteria(Criteria<JobServerDb> param){
		jobServerDbRepository.deleteByCriteria(param);
		return null;
	}

	public void setJobServerDbRepository(IJobServerDbRepository repository) {this.jobServerDbRepository = repository;}
	private IJobServerDbRepository jobServerDbRepository;
}
